import request from './request'
import { useUserStore } from '@/stores/useUserStore'

// 运行代码
export const runCode = (code: string) => {
  const { getUserInfo } = useUserStore()
  const { user_id } = getUserInfo()
  const prarms = {
    code,
    user_id: user_id.toString()
  }
  return request.post('/codeService/runPy', prarms)
}

// 将代码转换成流程图
export const convertToFlowChart = (code: string) => {
  const { getUserInfo } = useUserStore()
  const { user_id } = getUserInfo()
  const prarms = {
    code,
    user_id: user_id.toString()
  }
  return request.post('/codeService/transform', prarms)
}
